import request from "../utils/request"
import { BannerItem, CategoryItem, LikeItemOrHotItem, PropagateItem } from "../type/homeTypes"
import { ResponseType } from "../type/response"

enum Enum {
  fetchBannerListAPI = "/index/findBanner",
  fetchCategoryAPI = "/index/findCategory1",
  fetchPropagateAPI = "/index/advertisement",
  fetchLikeListAPI = "/index/findListGoods",
  fetchHotListAPI = "/index/findRecommendGoods"
}

/** 
*@description 获取轮播图的接口
*/
export const fetchBannerListAPI = () => request.get<ResponseType<BannerItem[]>>(Enum.fetchBannerListAPI)

/** 
*@description 获取一级分类的接口
*/
export const fetchCategoryAPI = () => request.get<ResponseType<CategoryItem[]>>(Enum.fetchCategoryAPI)

/** 
*@description 获取活动宣传的接口
*/
export const fetchPropagateAPI = () => request.get<ResponseType<PropagateItem[]>>(Enum.fetchPropagateAPI)

/**
 *@description 获取猜你喜欢的接口 
 */
export const fetchLikeListAPI = () => request.get<ResponseType<LikeItemOrHotItem[]>>(Enum.fetchLikeListAPI)

/**
*@description 获取人气推荐的接口 
*/
export const fetchHotListAPI = () => request.get<ResponseType<LikeItemOrHotItem[]>>(Enum.fetchHotListAPI)